<!DOCTYPE html>
<html lang="en">

<head>
    #include("./common/head.htm")
</head>

<body>
    #include("./common/header.htm")
    <div id="mainBody">
        <div class="container">
            <div class="row">
                #include("./common/sidebar.htm")
                <div class="span9" id="order-detail">
                    <ul class="breadcrumb">
                        <li><a href="/view/catalog-main.html">首页</a> <span class="divider">/</span></li>
                        <li><a href="/view/orders_all.html">订单</a><span class="divider">/</span></li>
                        <li class="active">订单详情</li>
                    </ul>
                    <div class="well">
                        <h2>订单{{orderID}} 详情
                            <span v-if="order.status === 0" class="label label-impotant pull-right">待付款</span>
                            <span v-else-if="order.status === 1" class="label label-info pull-right">等待发货</span>
                            <span v-else-if="order.status === 2" class="label label-primary pull-right">已发货</span>
                            <span v-else-if="order.status === 3" class="label label-success pull-right">确认收货</span>
                            <span v-else-if="order.status === 4" class="label label-warning pull-right">退货中</span>
                            <span v-else-if="order.status === 5" class="label label-default pull-right">退货成功</span>
                            <span v-else-if="order.status === 6" class="label label-default pull-right">拒绝退货</span>
                        </h2>
                        <br>
                        <div>
                            <h4>店铺名: <a :href="'/view/shops?shopid=' + order.shopid">{{order.shopname}}</a></h4>
                            <h4>{{"下单时间: " + order.ordertime}}</h4>
                            <h4>{{"到货时间: " + order.recevingtime}}</h4>
                        </div>

                        <table class="table table-striped">
                            <tr>
                                <th>#</th>
                                <th>商品</th>
                                <th>商品名称</th>
                                <th>商品描述</th>
                                <th>单价</th>
                                <th>数量</th>
                                <th>小计</th>
                                <th v-if="order.status >= 3"></th>
                            </tr>
                            <tr v-for="(orderitem,index) in order.orderItemVOList">
                                <td>{{index+1}}</td>
                                <td><a :href="'/view/product_details.html?itemid='+orderitem.itemid"><img
                                            style="height: 100px;" :src="refactor(orderitem.src)"
                                            :alt="orderitem.description" /></a></td>
                                <td>
                                    <a
                                        :href="'/view/product_details.html?itemid='+orderitem.itemid">{{orderitem.description}}</a>
                                </td>
                                <td>{{orderitem.attrdescription}}</td>
                                <td>{{orderitem.price.toFixed(2)}}</td>
                                <td>{{orderitem.num}}</td>
                                <td>{{"$"+orderitem.allprice.toFixed(2)}}</td>
                                <td v-if="order.status >= 3">
                                    <!-- <button class="btn btn-mini" data-toggle="modal" data-target="#comment-form"
                                        @click="openComment(orderitem.itemid, orderitem.description)">写评价</button> -->
                                    <button class="btn btn-mini"
                                        @click="openComment(orderitem.itemid, orderitem.description)">写评价</button>
                                </td>
                            </tr>

                            <tr>
                                <td colspan="6"><strong>总价</strong></td>
                                <td><strong>${{order.ordertotal.toFixed(2)}}</strong></td>
                                <td v-if="order.status >= 3"></td>
                            </tr>
                            <tr>
                                <td colspan="6"><strong>优惠券减免</strong></td>
                                <td><strong>${{order.orderdiscount.toFixed(2)}}</strong></td>
                                <td v-if="order.status >= 3"></td>
                            </tr>
                            <tr>
                                <td colspan="6"><strong>实付金额</strong></td>
                                <td><strong>${{order.actualpay.toFixed(2)}}</strong></td>
                                <td v-if="order.status >= 3"></td>
                            </tr>
                        </table>
                        <div class="btn-group" v-if="order.status === 0">
                            <button class="btn btn-success dropdown-toggle" data-toggle="dropdown">支付
                                <span class="caret"></span></button>
                            <ul class="dropdown-menu">
                                <li><a href="#" @click="pay()">直接支付</a></li>
                                <li><a href="#" @click="alipay()">使用支付宝支付</a></li>
                            </ul>
                        </div>
                        <div class="btn-group" v-if="order.status === 0">
                            <button class="btn" @click="deleteOrder(orderID)">取消订单</button>
                        </div>
                        <div class="btn-group" v-if="order.status === 3">
                            <!-- <a href="#return-form" role="button" data-target="#return-form"><span class="btn">申请退货</span></a> -->
                            <button class="btn btn-info btn-lg" data-toggle="modal"
                                data-target="#return-form">申请退货</button>
                        </div>
                        <div id="return-form" class="modal hide fade in" role="dialog" tabindex="-1"
                            aria-labelledby="login" aria-hidden="false">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                <h3>订单{{order.orderid}}</h3>
                            </div>
                            <div class="modal-body">
                                <div class="control-group">
                                    <h4>退货理由填写</h3>
                                </div>
                                <div class="control-group">
                                    <textarea class="input-xxlarge" id="textarea1" rows="3" v-model="reason"></textarea>
                                </div>
                                <button type="submit" class="btn btn-success" @click="returnOrder(orderID)">提交</button>
                                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>

                            </div>
                            <div class="modal-footer">
                            </div>
                        </div>
                        <div v-if="order.status === 6">
                            <h4>拒绝退货理由</h4>
                            <p>{{refusalReason}}</p>
                        </div>
                        <div id="comment-form" class="modal hide fade in" role="dialog" aria-labelledby="login"
                            aria-hidden="false">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                <h3>订单{{order.orderid}} 评价</h3>
                            </div>
                            <div class="modal-body">
                                <div class="control-group">
                                    <h4 id="comment-item-name">对商品 的评价</h3>
                                </div>
                                <div class="control-group">
                                    <textarea class="input-xxlarge" id="textarea2" rows="3"
                                        v-model="commentText"></textarea>
                                </div>
                                <button type="submit" class="btn btn-success" @click="submitComment()">提交</button>
                                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>

                            </div>
                            <div class="modal-footer">
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <!-- MainBody End ============================= -->
    #include("./common/footer.htm")
</body>

</html>